package net.fpeg.kotlin.msa.auth.service

import org.junit.jupiter.api.Test

import org.junit.jupiter.api.Assertions.*
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.web.WebAppConfiguration

@SpringBootTest
@WebAppConfiguration
internal class JwtServiceTest {

    @Autowired
    lateinit var jwtService: JwtService


    @Test
    fun encode() {
        println(jwtService.encode(123))
    }

    @Test
    fun decodeFail() {
        assertEquals(jwtService.decode("asd"), null)
    }

    @Test
    fun decodeSuccess() {
        assertEquals(jwtService.decode(jwtService.encode(123)), 123)
    }
}